#ifndef MUSICPLAYER_H
#define MUSICPLAYER_H

#include <QMainWindow>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QUrl>
#include <QDebug>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonValue>
#include <QList>
#include <QVector>
#include <vector>
#include <iostream>
#include <QTableView>
#include <QStandardItemModel>
#include <QStandardItem>
#include <memory>
#include <QMediaPlayer>
#include <QMediaPlaylist>
#include "musicplayinginterface.h"
#include <QPoint>

using namespace std;
namespace Ui {
class musicPlayer;
}

class musicPlayer : public QWidget
{
    Q_OBJECT

public:
    explicit musicPlayer(QWidget *parent = nullptr);
    ~musicPlayer();
    void parseJson(QByteArray byteArray);
    void mouseMoveEvent(QMouseEvent *e);//鼠标移动
    void mousePressEvent(QMouseEvent *e);//鼠标按下移动
public slots:
    void replyFinished(QNetworkReply *reply);
    //    void updateDuration(qint64 value);
    void positionChangedSlot(qint64 position);
    void durationChangedSlot(qint64 duration);
    void on_hs_songtime_3_sliderReleased();
private slots:
    void on_pushButton_clicked();

    void on_tableView_doubleClicked(const QModelIndex &index);

    void on_toolButton_clicked();

    void on_toolButton_2_clicked();

    void on_toolButton_3_clicked();

    void on_downButton_2_clicked();

    void on_playButton_2_clicked();

    void on_upButton_2_clicked();

//    void on_hs_songtime_3_valueChanged(int value);

//    void on_hs_songtime_3_sliderPressed();

//    void on_hs_songtime_3_sliderReleased();

private:
    Ui::musicPlayer *ui;
    QNetworkAccessManager * manager;
    QStandardItemModel * pModel;
    QStandardItem * item_1;
    QStandardItem * item_2;
    QStandardItem * item_3;
    QStandardItem * item_4;
    QMediaPlayer * player;
    QMediaPlaylist * playList;
    unsigned int songId;//歌ID
    MusicPlayingInterface * musicPlayingInter;
    QPoint p;
    bool canchange;                             //用于拖动进度条
};

#endif // MUSICPLAYER_H
